[slug].tsx 3.0 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677787980
  1. import { useRouter } from "next/router"
  2. import Image from "next/legacy/image"
  3. import bios from "../../data/bio"
  4. import board from "../../data/board"
  5. import { withDefaultStaticProps } from "../../utils/defaultStaticProps"
  6. import { mapMastodonUrlToHandle, mapBoardPositionToLabel } from "../../utils/map"
  7. import Layout from "../../components/Layout"
  8. import LogoWhite from "../../public/logos/logo-white.svg?inline"
  9. const missingAvatarSrc = require("../../public/avatars/missing_avatar.png")
  10. const AboutMember = () => {
  11. const router = useRouter()
  12. const member = board.find(member => member.slug === router.query.slug)
  13. const avatarSrc = member.avatar || missingAvatarSrc;
  14. const boardPositionLabel = mapBoardPositionToLabel(member.position);
  15. return (
  16. <Layout transparentHeader={false}>
  17. <div dir="ltr" className="[unicode-bidi:plaintext]"></div>
  18. <div className="full-width-bg">
  19. <div className="mx-auto w-full max-w-site px-6 sm:px-20 lg:px-32 xl:px-52">
  20. <div className="md:grid md:grid-cols-12 md:gap-y-24 pt-40 pb-10 md:gap-x-12 border-b border-gray-3 ">
  21. <div className="md:col-span-7 md:col-start-6">
  22. <span className="h3">{member.name}</span>
  23. </div>
  24. </div>
  25. <div className="md:grid md:grid-cols-12 md:gap-y-24 pt-10 pb-60 md:gap-x-12">
  26. <div className="md:col-span-5 mb-10">
  27. <div className="flex flex-col text-center items-center">
  28. <div className="mb-4">
  29. <Image src={avatarSrc} width="170" height="170" alt="" className="rounded-full"/>
  30. </div>
  31. {member.otherTitle && (
  32. <div className="b2 mt-2">{member.otherTitle}</div>
  33. )}
  34. <div className="b2 mt-2">
  35. {member.title ? `${boardPositionLabel}, ${member.title}` : boardPositionLabel}
  36. </div>
  37. {member.socials && (
  38. <div className="flex flex-row items-center mt-2">
  39. <LogoWhite
  40. className="h-[1em] w-[1em] text-blurple-600 -mb-1"
  41. fill="currentColor"
  42. />
  43. <a
  44. href={member.socials.mastodon}
  45. rel="me"
  46. className="b2 ml-2 block flex-shrink-0 text-blurple-600 hocus:underline"
  47. >
  48. {mapMastodonUrlToHandle(member.socials.mastodon)}
  49. </a>
  50. </div>
  51. )}
  52. </div>
  53. </div>
  54. <div className="md:col-span-7 lg:col-span-6 md:col-start-6">
  55. <p className="b2">
  56. {bios[member.slug]}
  57. </p>
  58. </div>
  59. </div>
  60. </div>
  61. </div>
  62. </Layout>
  63. )
  64. }
  65. export async function getStaticPaths() {
  66. const paths = board.filter(member => member.slug).map((member) => ({
  67. params: { slug: member.slug },
  68. }))
  69. return { paths, fallback: false }
  70. }
  71. export const getStaticProps = withDefaultStaticProps()
  72. export default AboutMember